<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>数据系统</title>
    <script src="{{url_for('static', path='/layui/echarts.min.js')}}"></script>
    <script src="{{url_for('static', path='/layui/layui.js')}}"></script>
    <script src="{{url_for('static', path='/layui/jquery-3.5.1.min.js')}}"></script>
    <link rel="stylesheet" href="{{url_for('static', path='/layui/css/layui.css')}}" media="all">
</head>
<body>
<form id="form1" class="layui-form" action="">
    <div class="layui-form-item layui-form-text" style="width: 1000px;padding-top: 60px;">
        <div class="layui-input-block">
            <textarea name="title" placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<div id="body" class="layui-body">{{title}}</div>
</body>
<script>
    layui.use('form', function () {
        var form = layui.form;
        form.on('submit(formDemo)', function (data) {
            var articleFrom = JSON.stringify(data.field);
            console.log(articleFrom)
            $.ajax({
                type: "POST",
                url: "/analysis/sql/result",
                contentType: "application/json",
                data: articleFrom,
                // dataType: "JSON",
                success: function (data) {
                    $("#body").html(data)
                }
            });
            return false;
        });
    });
</script>
</html>
